[Solved] How do I pivot with hour format(HH:HourNumber)?

First of all create a temp table to use it in 3 places – Select columns for pivot, Replace null with zero and inside pivot. SELECT DISTINCT SUM(ORDERTOTAL) OVER(PARTITION BY CAST(ORDERTIME AS DATE),DATEPART(HH,ORDERTIME)) [TOTAL], CONVERT(varchar, CAST(ORDERTIME AS datetime), 103) [DATE], DATEPART(HH,ORDERTIME) [HOUR], ‘HH:’+CAST(DATEPART(HH,ORDERTIME) AS VARCHAR(3)) [HOURCOL] INTO #NEWTABLE FROM ORDERTBL ORDER BY DATEPART(HH,ORDERTIME) Now declare … Read more

[Solved] mysql rows count by where clause

Try using this query – $query = mysqli_query(“SELECT subcommentid,COUNT(*) as count FROM table GROUP BY subcommentid ORDER BY count DESC;”); $result = mysqli_fetch_array($query); echo $result[‘subcommentid’].'<br/>’; //subcomment id echo $result[‘count’]; // number of rows If you want all, store in array – $results = array(); while($row = mysqli_fetch_array($query)) { $results[$row[‘subcommentid’]] = $row[‘count’]; } echo “<pre>”;print_r($results);exit; 2 … Read more

[Solved] Create UIntPtr from hex literal

To create a UIntPtr from a UInteger, use its constructor: NativeMethods.SetProcessWorkingSetSize( itemProcess.Handle, New UIntPtr(&HFFFFFFFFUI), New UIntPtr(&HFFFFFFFFUI)) solved Create UIntPtr from hex literal

[Solved] Retrieve value in HashMap [closed]

A Map is a key-value pair, i.e., a value is associated to a key. Your code can be refactored as follows: Map<String, Object> details = taskManager.getFormDetails(appSessionURI, accessToken); //System.out.println(“Details :” + details); String fileName = (String)details.get(“fileName”); String refGene = (String)details.get(“refgene”); 3 solved Retrieve value in HashMap [closed]

[Solved] which code execute faster?

Given what you have posted, Example 1 int d; d=0; d=a+b; /* print d+c+e;*/ printf(“%i\n”, d+c+e); Example 2 /* print a+b+c+e; */ printf(“%i\n”, a+b+c+e); Which is faster is tricky, if your compiler optimizes d away in Example 1 they are equivalent. On the other hand, if your compiler can’t determine that d=0 is discarded (and … Read more

[Solved] Ip Restriction with .httacces [closed]

The 1000th time: NO, you can’t protect your website by IP restrictions. Attackers could use use proxies or spoof their IP’s. If you really encounter some sort of heavy traffic from one single IP, you could temporarily block this IP using a system-wide firewall rule (check iptables). Temporary because this IP will likely change frequently. … Read more

[Solved] How to do this: example.com/users/user1 [closed]

You need somthing like this? Not clear what is your requirement. Check this blog for more Rewriting example.com/user.php?username=xyz to example.com/xyz RewriteEngine On RewriteRule ^([a-zA-Z0-9_-]+)$ user.php?username=$1 RewriteRule ^([a-zA-Z0-9_-]+)/$ user.php?username=$1 Refer htaccess2 tricks solved How to do this: example.com/users/user1 [closed]

[Solved] What does @ mean when creating a SQL query with C#? [duplicate]

It’s a bound parameter marker. You’ll need to list all bound parameters in the Parameters collection. Using bound parameters as opposed to just constructing the SQL text directly helps with security (prevents injection attacks) and performance. solved What does @ mean when creating a SQL query with C#? [duplicate]

[Solved] What is SQL injection? And what is it use and plese give me a some real time example Regards & Thanks Hareesh [closed]

User input that deliberately contains SQL code to do harmful things, and isn’t disabled or sanitized by the code. E.g., $who = $_GET[‘customer_id’]; … DELETE from records WHERE customer_id = ‘$who’ could be injected with something similar to customer_id=1234′ and 1=1 and ”=’, resulting in DELETE from records WHERE customer_id = ‘1234’ and 1=1 and … Read more

[Solved] get world phone codes list [closed]

Create a new Raw XML file with the following content: <string-array name=”CountryCodes” > <item>93,AF</item> <item>355,AL</item> <item>213,DZ</item> <item>376,AD</item> <item>244,AO</item> <item>672,AQ</item> <item>54,AR</item> <item>374,AM</item> <item>297,AW</item> <item>61,AU</item> <item>43,AT</item> <item>994,AZ</item> <item>973,BH</item> <item>880,BD</item> <item>375,BY</item> <item>32,BE</item> <item>501,BZ</item> <item>229,BJ</item> <item>975,BT</item> <item>591,BO</item> <item>387,BA</item> <item>267,BW</item> <item>55,BR</item> <item>673,BN</item> <item>359,BG</item> <item>226,BF</item> <item>95,MM</item> <item>257,BI</item> <item>855,KH</item> <item>237,CM</item> <item>1,CA</item> <item>238,CV</item> <item>236,CF</item> <item>235,TD</item> <item>56,CL</item> <item>86,CN</item> <item>61,CX</item> <item>61,CC</item> <item>57,CO</item> <item>269,KM</item> <item>242,CG</item> <item>243,CD</item> … Read more

[Solved] How can we find number of distinct elements in a given submatrix? [closed]

It depends how many queries you can expect, and the number of identical queries you can expect. One approach is to “memoize” queries, simply to store each query and result, and look that up before doing more serious work. A more problem-specific approach – probably what your teacher is after – is to compute distinct … Read more

[Solved] Activating JButton when radio button is enabled? [closed]

Use itemStateChanged event to detect the radio button enabled & do your stuff, @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { yourButton.enabled=true; } else if (e.getStateChange() == ItemEvent.DESELECTED) { yourButton.enabled=false; } } 1 solved Activating JButton when radio button is enabled? [closed]