I am aware of the MySQL Date_Format function but am looking to achieve the following:
I have on column with a day date in 2 digit format (01-30). I am trying to update another date formatted field with the current year, the next month (m+1) and the day field mentioned previously.
In PHP i would do this using mktime function but this must be done using mysql calls only.
Is it possible to transform in this way?
You need to use division and remainder by 10. Consider this example:
163 divided by 10 is 16 remainder 3
16 divided by 10 is 1 remainder 6
1 divided by 10 is 0 remainder 1
You'll notice the remainder is always the last digit of the number that's being divided. Now figure out a way to do this in C...
How do i do it in c Help :(
Some of the plugins I wrote (re)calculate various prices, and I used Math.Round to keep results accurate with the default 2 digit setting in CRM.
But I figured... what if a user decides to set his CRM to use a different precision?
So, I need to access the CRM settings programmatically, so that my functions can work with whatever setting the user chooses.
How would I go about accessing the General (and, possibly, other) CRM settings from my code?
Hi there,
I am in need of reorganizing a large CSV file. The first column, which is currently a 6 digit number needs to be split up, using comma's as the field separator.
For example, I need this:
022250,10:50 AM,274,22,50
022255,11:55 AM,275,22,55
turned into this:
0,2,2,2,5,0,10:50 AM,274,22,50
0,2,2,2,5,5,11:55 AM,275,22,55
Let me know what you think!
Thanks!
Is there any way to group the edit buttons displayed above the edit dialog in MediaWiki? By grouping, I mean like Word does (and even this editor) - you can add dividing lines to group them so that e.g. Bold and Italic are in one group, numbered list and bullet points in another.
We've added lots of new buttons (in EditPage.php) and they are in a logical order, but at 30 buttons it is a bit overwhelming for some users.
I have a list of strings similar to this list:
tags = ('apples', 'apricots', 'oranges', 'pears', 'peaches')
How should I go about grouping this list by the first character in each string using itertools.groupby()? How should I supply the 'key' argument required by itertools.groupby()?
I have a number 9877342931235. Using Haskell, I need to show it as:
987-734293-123-5
i've tried interspersing the list but of course that puts '-' between every digit. How would I do it to yield the actual result?
Hello,
I have a table like that
1 A_Team 11
2 A_Team 3
3 B_Team 2
4 A_Team 1
5 A_Team 1
What I want is grouping the same named teams which are also sequential teams
So the result table should look like
1 A_Team 14
2 B_Team 2
3 A_Team 2
Thanks
I have the following simple SQL statment
SELECT id, name, value_name, value_id
FROM table
GROUP BY id
ORDER BY value_id DESC
when grouping I would like to get the value_name and value_id of the tuple where the value_id is the biggest. The way it is i am getting the smallest value. For example
1, name1, valuename, 3 (where i know that there is a value_id of 5)
Can you please help?
I have an 8 digit integer which I would like to print formatted like this:
XXX-XX-XXX
I would like to use a function that takes an int and returns a string.
What's a good way to do this?
I am working in phpMyadmin using SQL.
I want to take the primary key (EntryID) from TableA and create a cartesian product (if I am using the term correctly) in TableB (empty table already created) for all entries which share the same value for FieldB in TableA, except where TableA.EntryID equals TableA.EntryID
So, for example, if the values in TableA were:
TableA.EntryID TableA.FieldB
1 23
2 23
3 23
4 25
5 25
6 25
The result in TableB would be:
Primary key EntryID1 EntryID2 FieldD (Default or manually entered)
1 1 2 Default value
2 1 3 Default value
3 2 1 Default value
4 2 3 Default value
5 3 1 Default value
6 3 2 Default value
7 4 5 Default value
8 4 6 Default value
9 5 4 Default value
10 5 6 Default value
11 6 4 Default value
12 6 5 Default value
I am used to working in Access and this is the first query I have attempted in SQL.
I started trying to work out the query and got this far. I know it's not right yet, as I’m still trying to get used to the syntax and pieced this together from various articles I found online. In particular, I wasn’t sure where the INSERT INTO text went (to create what would be an Append Query in Access).
SELECT EntryID
FROM TableA.EntryID
TableA.EntryID
WHERE TableA.FieldB=TableA.FieldB
TableA.EntryID<>TableA.EntryID
INSERT INTO TableB.EntryID1
TableB.EntryID2
After I've got that query right, I need to do a TRIGGER query (I think), so if an entry changes it's value in TableA.FieldB (changing it’s membership of that grouping to another grouping), the cartesian product will be re-run on THAT entry, unless TableB.FieldD = valueA or valueB (manually entered values).
I have been using the Designer Tab. Does there have to be a relationship link between TableA and TableB. If so, would it be two links from the EntryID Primary Key in TableA, one to each EntryID in TableB? I assume this would not work because they are numbered EntryID1 and EntryID2 and the name needs to be the same to set up a relationship?
If you can offer any suggestions, I would be very grateful.
Research:
http://www.fluffycat.com/SQL/Cartesian-Joins/
Cartesian Join example two
Q: You said you can have a Cartesian join by joining a table to itself. Show that!
Select *
From Film_Table T1,
Film_Table T2;
Is it possible to update an EXEs AssemblyInformationalVersion attribute? I'm trying to include additional information in the setup.exe output from an InstallAware project rather than just the standard 4 digit version info.
Hi!
I would like to create some kind of open free "group" posting of photos with geotags
First I thought about Panoramio, but seems there is no API for photos upload.
By now I can see only two ways:
Flickr - there are groups but you have to approve group membership anyway, or use tags for grouping which is bad for maintenance
Custom server solution which will cost efforts and hosting
Can you suggest other free photo services with geotags functionality, or opensource solutions?
Thank you!
Is there any way how to override DataGrids header line ? Or at least its behaviour ? I'm trying to implement Outlook-like grouping of the table. That is allow user to drag column header out of the table to the dedicated area to sort by that column (for example XamDataGrid has that feature, you can see how it works here).
I cannot use any commercial solutions.
I will be thankfull for any experiences, ideas, code, notes or tutorials.
I have two grouping levels in a report. Group A can have a Percentage() of the entire report and so can Group B, but I would like to know the Percentage() of Group A of Group B. Even if I code it, it seems like once the inner and outer groups have created their footers, I can't go back to to the inner group and set it's value.
Example:
Group A Total 50
Group A percentage of Report Total = 33%
Group A Percentage of Group B Total = 33% but I want 50%
Group B Total 100
Group B Percentage of Report Total = 66%
Report Total 150
I have a table as follows
Table item {
ID - Primary Key
content - String
published_date - When the content was published
create_date - When this database entry was created
}
Every hour (or specified time interval) I run a process to update this table with data from different sources (websites). I want to display the results according to the following rules.
1. The entries created each time the process runs should be grouped together. So the entries from the 2nd process run will always be after the entries from the first process run even if the published_date of an entry from the first run is after the published_date of an entry from the 2nd run.
2. Within the grouping by run, the entries by sorted by published_date
3. Another restriction is that I prefer that data from the same source not be grouped together. If I do the sort by create_date, published_date I will end up with data from source a, data from source b etc. I prefer that the data within each hour be mixed up for better presentation
If I add a column to this table and store a counter which increments each time the process is run, it is possible to create a query to sort first by counter and then by published_dt. Is there a way to do it without adding a field? I'm using Hibernate over MySQL.
e.g.
Hour 1 (run 1)
4 rows collected from site a (rows 1-4)
3 rows collected from site b (rows 5-7)
hour 2 (run 2)
2 row collected from site a (rows 8-9)
3 rows collected from site b (rows 10-12)
...
After each run, new records are added to the database from each website. The create date is the time when the record was created in the database. The published date is part of the content and is read in from the external source.
When the results are displayed I would like rows to be grouped together based on the hour they were published in. So rows 1-7 would be displayed before rows 8-12. Within each hourly grouping, I would like to sort the results by published date (timestamp). This is necessary so that the posts from all the sites collected in that hour are not grouped together but rather mixed in with each other.
I have a string based code that can be either two or three characters in length and I am looking for some help in creating a function that will increment it.
Each 'digit' of the code has a value of 0 to 9 and A to Z.
some examples:
the first code in the sequence is 000
009 - next code is - 00A
00D - next code is - 00E
AAZ - next code is - AB0
the last code is ZZZ.
Hope this makes some sense.
Does anyone know of a way to inject rows into a Silverlight DataGrid? I need a way to add totals rows after every 6 entries. The totals are for all rows above the summary row, not just the previous six.
I've tried doing it with grouping but that only shows the totals for the group and displays the totals rows above the actual rows. I would prefer to use a DataGrid for this if possible, but all solutions are welcome.
in visual studio is the member dropdown, where you can select all members of the current type alphabetically ordered.
is there an option which allows grouping of the members? i.e. all constructors before all methods before all properties before all events before all fields?
if there is not, bad for me, i guess—it would really enhance productivity
I would basically like to do the same as this question, but grouping by combinations of two values, rather than just one:
SELECT player_type, team, COUNT(*) FROM players GROUP BY player_type, team;
Does anyone know whether, and how, this is possible in Django? I'm using 1.2.
I could actually see a use for the Google Annotations Gallery in real code:
Stumble across code that somehow works
beyond all reason? Life's short. Mark
it with @Magic and move on:
@Magic
public static int negate(int n) {
return new Byte((byte) 0xFF).hashCode()
/ (int) (short) '\uFFFF' * ~0
* Character.digit ('0', 0) * n
* (Integer.MAX_VALUE * 2 + 1)
/ (Byte.MIN_VALUE >> 7) * (~1 | 1);
}
This is a serious question. Could this be used in an actual code review?
i am building a simple PM for my personal website where a user can join and send message to the registered users on my website,
i am stuck in grouping and selecting latest user (by latest msg time) in INBOX page
my table :
id msg_from msg_to msg date in_del out_del
i want to show latest user's id each in a group
here is my SQL query :
SELECT ttalk.id, ttalk.msg_from, users.first_name, users.last_name
FROM ttalk
INNER JOIN users ON ttalk.msg_from = users.id
WHERE ttalk.msg_to = '$_SESSION[user_id]' AND ttalk.in_del='0'
GROUP BY ttalk.msg_from DESC LIMIT 500
Thanks in advance :-)
Having trouble with a challenge.
Let's say I have a theoretical, base 10, floating point calculator with the following characteristics
Only 3 digits for mantissa
1 digit for exponent
Sign for mantissa and exponent
How would this machine compute the following?
300 + \sum_{i=1}^{100} 0.2
The correct result is 320. The machine's result is 300. But why? Can't get where the 20 goes goes missing...
Thanks for your time.