[Solved] Avoid data redundancy in a friends table

Add field friendship_key: ALTER TABLE t_friend ADD friendship_key decimal(22,11); CREATE UNIQUE INDEX friendship_key_unique ON t_friend (friendship_key); And php part: $friends = [$userId, $friendId]; $key = min($friends).’.’.max($friends); $q = “SELECT * FROM t_friend WHERE friendship_key = “.$key; insert: $friends = [$userId, $friendId]; $key = min($friends).’.’.max($friends); $q = “INSERT INTO t_friend (friendship_key, userId, friendId) VALUES (“.implode(‘,’, [$key, … Read more

[Solved] Set a unique URL for each user profile

This isn’t really a PHP question. You’ll need to use a .htaccess file (if you’re using an Apache server) or equivalent. You’ll need to add a line, something like the following: RewriteRule ^([a-z]+)$ docname.php?u=$1 solved Set a unique URL for each user profile

[Solved] Trouble with C program blank output [closed]

Since string is an array, you don’t use & when passing it to scanf(), this gives you a double pointer and is an error. Any time you find yourself with a 10 clause if statement, you’re just asking for problems (e.g. easy to get tripped up by typos.) You can simplify this test with index() … Read more

[Solved] How do I read twitter data saved in a txt file?

Since what you have is valid JSON, you can use a JSON parser: import json json_string = r”'{“created_at”:”Sun Jul 03 15:23:11 +0000 2016″,”id”:749624538015621120,”id_str”:”749624538015621120″,”text”:”Et hop un petit muldo dor\u00e9-indigo #enroutepourlaG2″,”source”:”\u003ca href=\”http:\/\/twitter.com\” rel=\”nofollow\”\u003eTwitter Web Client\u003c\/a\u003e”,”truncated”:false,”in_reply_to_status_id”:null,”in_reply_to_status_id_str”:null,”in_reply_to_user_id”:null,”in_reply_to_user_id_str”:null,”in_reply_to_screen_name”:null,”user”:{“id”:3050686557,”id_str”:”3050686557″,”name”:”Heresia”,”screen_name”:”Air_Et_Zia”,”location”:null,”url”:null,”description”:”Joueur de Dofus depuis 6 ans. Essentiellement ax\u00e9 PvP. Actuellement sur #Amayiro !”,”protected”:false,”verified”:false,”followers_count”:296,”friends_count”:30,”listed_count”:0,”favourites_count”:23,”statuses_count”:216,”created_at”:”Sat Feb 21 20:45:02 +0000 2015″,”utc_offset”:null,”time_zone”:null,”geo_enabled”:false,”lang”:”fr”,”contributors_enabled”:false,”is_translator”:false,”profile_background_color”:”000000″,”profile_background_image_url”:”http:\/\/abs.twimg.com\/images\/themes\/theme1\/bg.png”,”profile_background_image_url_https”:”https:\/\/abs.twimg.com\/images\/themes\/theme1\/bg.png”,”profile_background_tile”:false,”profile_link_color”:”9266CC”,”profile_sidebar_border_color”:”000000″,”profile_sidebar_fill_color”:”000000″,”profile_text_color”:”000000″,”profile_use_background_image”:false,”profile_image_url”:”http:\/\/pbs.twimg.com\/profile_images\/569237837581545472\/e_OJaGOl_normal.png”,”profile_image_url_https”:”https:\/\/pbs.twimg.com\/profile_images\/569237837581545472\/e_OJaGOl_normal.png”,”default_profile”:false,”default_profile_image”:false,”following”:null,”follow_request_sent”:null,”notifications”:null},”geo”:null,”coordinates”:null,”place”:null,”contributors”:null,”is_quote_status”:false,”retweet_count”:0,”favorite_count”:0,”entities”:{“hashtags”:[{“text”:”enroutepourlaG2″,”indices”:[34,50]}],”urls”:[],”user_mentions”:[],”symbols”:[]},”favorited”:false,”retweeted”:false,”filter_level”:”low”,”lang”:”fr”,”timestamp_ms”:”1467559391870″}”’ twit = json.loads(json_string) print (json.dumps(twit[“text”]))#or … Read more

[Solved] How do I make my java program run in the background? [closed]

Look ma, no windows here, just us teddies… public class TestTrayIcon01 { public static void main(String[] args) { new TestTrayIcon01(); } public TestTrayIcon01() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { TrayIcon icon = new TrayIcon(ImageIO.read(getClass().getResource(“/SmallTeddy.png”))); SystemTray tray = SystemTray.getSystemTray(); tray.add(icon); } catch (Exception ex) { ex.printStackTrace(); } JDialog dialog = new … Read more

[Solved] Get error say no match for call in c++ [closed]

You asked Eclipse to find the class definition, and it found it. Your problem lies in pluginConfig. I’m guessing you have written FixedPluginConfig pluginConfig; pluginConfig(FixedPluginConfig(“.”, “createClientFactory”)); which won’t work, because a FixedPluginConfig isn’t something that can be called with a FixedPluginConfig argument. Hence the “no match for call” error message. What you probably mean is … Read more

[Solved] What’s the error in this c++ code?

That’s because you have ; after your while. The ; causes the while loop to run indefinitely without even getting to: x=x+10; You may change your code to while(x < y) { x = x + 10; cout << x << ” ” << y << endl; } solved What’s the error in this c++ … Read more